package threadDemo1.lambda;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 38917
 * Date: 2025-02-26
 * Time: 21:52
 */
//lambda表达式
public class ThreadDemo {
    public static void main(String[] args) {
        Thread thread = new Thread(()->{
           while (true){
               System.out.println("Hello Thread");
               try {
                   Thread.sleep(1000);
               } catch (InterruptedException e) {
                   throw new RuntimeException(e);
               }
           }
        },"我的线程");
        thread.start();

        while (true){
            System.out.println("Hello Main");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
